# -*- coding: utf-8 -*-

from odoo import models, fields, api

NOTIFICATION_TYPE = [('inbox', 'Handle in Odoo'), ('email', 'Handle by Emails'), ('ding_talk', 'Handle by Ding_talk')]


class UpdbsReviewerLine(models.Model):
    _name = 'updbs.reviewer.line'
    _description = 'Reviewer Line Info'
    _rec_name = 'name'

    name = fields.Char(string='Name', required=True, track_visibility='onchange')
    reviewer = fields.Many2one('hr.employee', string='Reviewer Name', required=True, track_visibility='onchange')
    level = fields.Integer(string='Level', default=1, required=True, track_visibility='onchange')
    reviewer_id = fields.Many2one('updbs.reviewer', string='Reviewer', track_visibility='onchange')


class UpdbsReviewer(models.Model):
    _name = 'updbs.reviewer'
    _description = 'Reviewer Settings'
    _inherit = ['mail.thread']
    _rec_name = 'model_id'

    model_id = fields.Many2one('ir.model', string='Model', track_visibility='onchange')
    notification_type = fields.Selection(NOTIFICATION_TYPE, string='Message Sending Method', track_visibility='onchange')
    line_ids = fields.One2many('updbs.reviewer.line', 'reviewer_id', string='Reviewer Line', track_visibility='onchange')
    active = fields.Boolean(default=True, track_visibility='onchange')
    # superior_reviewer = fields.Many2one('updbs.reviewer', string='Superior Reviewer')
